// 可根据不同的UI组件库设置对应的消息提示

import { message as Message_Antdv } from "ant-design-vue"
import { Message as Message_Elementui } from "element-ui"

let messageType = 'elementui'
let message = {
    antdv: Message_Antdv,
    elementui: Message_Elementui,
}

// 消息提示
export function useMessage() {
    return {
        createMessage: (options) => {
            let option = {
                duration: messageType == 'antdv' ? options.duration : options.duration * 1000,
            }
            if (messageType == 'antdv') {
                option.content = options.content
            } else if (messageType == 'elementui') {
                option.message = options.content
            }
            message[messageType][options.type](option)
        },
    }
}
